package com.example.tourpal.util;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.example.tourpal.model.PrivateMessage;
import com.example.tourpal.widget.ClockItemView;

public class ClockAdapter extends BaseAdapter {
	private List<PrivateMessage> mContent;
	private Context context;
	private int userId = 0;
	public ClockAdapter(Context context, List<PrivateMessage> list, int id) {
		this.context = context;
		mContent = list;
		this.userId = id;
	}

	public void addPrivateMessage(PrivateMessage msg){
		mContent.add(msg);
	}
	
	@Override
	public int getCount() {
		if (mContent != null && mContent.size() != 0) {
			return mContent.size();
		}
		return 0;
	}

	@Override
	public Object getItem(int arg0) {
		return arg0;
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
		if (paramView == null)
			paramView = new ClockItemView(context);
		ClockItemView localClockItemView = (ClockItemView) paramView;
		localClockItemView.bindItemView(paramView, paramViewGroup, paramInt,
				mContent.get(paramInt), userId);
		return paramView;
	}
}
